<html><head><title>StringGadget</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">StringGadget()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#3A3966"><b>StringGadget</b></font>(#Gadget, x, y, Width, Height, Content$ [, Flags])</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Creates a String gadget in the current GadgetList. It allows the user to enter a single line of text. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Gadget</i></td>
<td width="90%"> 
A number to identify the new gadget. <a href="../reference/purebasic_objects.html">#PB_Any</a> can 
be used to auto-generate this number. 

</td></tr>
<tr><td><i>x, y, Width, Height</i></td>
<td> 
The position and dimensions of the new gadget. 

</td></tr>
<tr><td><i>Content$</i></td>
<td> 
The initial content of this StringGadget. 
This gadget accepts only one line of text. To get multi-line input, use the <a href="editorgadget.html">EditorGadget()</a> function. 

</td></tr>
<tr><td><i>Flags (optional)</i></td>
<td> 
Flags to modify the gadget behavior. It can be a combination of the following values: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_String_Numeric</font>    : Only (positive) integer numbers are accepted.
  <font color="#924B72">#PB_String_Password</font>   : Password mode, displaying only '*' instead of normal characters.
  <font color="#924B72">#PB_String_ReadOnly</font>   : Read-only mode. No text can be entered.
  <font color="#924B72">#PB_String_LowerCase</font>  : All characters are converted to lower case automatically.
  <font color="#924B72">#PB_String_UpperCase</font>  : All characters are converted to upper case automatically.
  <font color="#924B72">#PB_String_BorderLess</font> : No borders are drawn around the gadget.
</font></pre>

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

Returns nonzero on success and zero on failure. If <font color="#924B72">#PB_Any</font> was used as the #Gadget parameter 
then the return-value is the auto-generated gadget number on success. 

</blockquote><p><b>Remarks</b></p><blockquote>

Later the content can be changed with <a href="setgadgettext.html">SetGadgetText()</a> and received with <a href="getgadgettext.html">GetGadgetText()</a>. 
<br>
<br>
The following events are supported through <a href="../window/eventtype.html">EventType()</a>: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_EventType_Change</font>    : The text has been modified by the user.
  <font color="#924B72">#PB_EventType_Focus</font>     : The StringGadget got the focus.
  <font color="#924B72">#PB_EventType_LostFocus</font> : The StringGadget lost the focus.
</font></pre>

The following functions can be used to act on this gadget: 
<br>
<br>
- <a href="setgadgetcolor.html">SetGadgetColor()</a> and <a href="getgadgetcolor.html">GetGadgetColor()</a> functions with the following values as 'ColorType': 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Gadget_FrontColor</font>: Textcolor
  <font color="#924B72">#PB_Gadget_BackColor</font> : Backgroundcolor
</font></pre>

- <a href="getgadgetattribute.html">GetGadgetAttribute()</a> with the following attribute: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_String_MaximumLength</font>: Returns the maximum number of characters which can be entered.
</font></pre>

- <a href="setgadgetattribute.html">SetGadgetAttribute()</a> with the following attribute: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_String_MaximumLength</font>: Set the maximum number of characters which can be entered.
</font></pre>

A 'mini help' can be added to this gadget using <a href="gadgettooltip.html">GadgetToolTip()</a>. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <font color="#3A3966">; Shows possible flags of StringGadget in action...</font>
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 0, 0, 322, 205, &quot;StringGadget Flags&quot;, <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
<font color="#3A3966">    StringGadget</font>(0, 8,  10, 306, 20, &quot;Normal StringGadget...&quot;)
<font color="#3A3966">    StringGadget</font>(1, 8,  35, 306, 20, &quot;1234567&quot;, <font color="#924B72">#PB_String_Numeric</font>)
<font color="#3A3966">    StringGadget</font>(2, 8,  60, 306, 20, &quot;Read-only StringGadget&quot;, <font color="#924B72">#PB_String_ReadOnly</font>)
<font color="#3A3966">    StringGadget</font>(3, 8,  85, 306, 20, &quot;lowercase...&quot;, <font color="#924B72">#PB_String_LowerCase</font>)
<font color="#3A3966">    StringGadget</font>(4, 8, 110, 306, 20, &quot;uppercase...&quot;, <font color="#924B72">#PB_String_UpperCase</font>)
<font color="#3A3966">    StringGadget</font>(5, 8, 140, 306, 20, &quot;Borderless StringGadget&quot;, <font color="#924B72">#PB_String_BorderLess</font>)
<font color="#3A3966">    StringGadget</font>(6, 8, 170, 306, 20, &quot;Password&quot;, <font color="#924B72">#PB_String_Password</font>)
    <b><font color="#3A3966">Repeat</font></b> : <b><font color="#3A3966">Until</font></b> <font color="#3A3966">WaitWindowEvent</font>() = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>
<br>
<p><img src="../HelpPictures/stringgadget.png"></p>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="getgadgettext.html">GetGadgetText()</a>, <a href="setgadgettext.html">SetGadgetText()</a>, <a href="getgadgetcolor.html">GetGadgetColor()</a>, <a href="setgadgetcolor.html">SetGadgetColor()</a>, <a href="editorgadget.html">EditorGadget()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=splittergadget.html>SplitterGadget()</a> - <a href="index.html">Gadget Index</a> - <a href="textgadget.html">TextGadget()</a> -><br><br>

</body></html>